package com.pi.pro.xcmg.am.common.vo.act;

import com.fasterxml.jackson.annotation.JsonView;
import com.pi.framework.core.vo.BaseVo;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import org.hibernate.validator.constraints.Length;

import javax.validation.ConstraintViolation;
import java.util.HashSet;
import java.util.Set;

/**
 *
 */
@Getter
@Setter
public class CountItemDto extends BaseVo {
    private static final long serialVersionUID = 3288010791203212037L;

    private Set<ConstraintViolation<?>> errs = new HashSet<>();

    private String errorMessage;

    public boolean hasError(String propertyPath) {
        for (ConstraintViolation<?> c : errs) {
            if (propertyPath.equals(c.getPropertyPath().toString()))
                return true;
        }
        return false;
    }
    public <T> Set<ConstraintViolation<T>> addAll(Set<ConstraintViolation<T>> errors) {
        errs.addAll(errors);
        return errors;
    }

    @Length(max = 200, message = "物料英文名称长度需要在{min}和{max}之间")
    private String materialCode;

    @Length(max = 200, message = "物料英文名称长度需要在{min}和{max}之间")
    private String containerNumber;

    public CountItemDto(){
        //
    }

}
